<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Vue</title>
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
  <div id="root"></div>
  <script>
    // observable
    // 让一个对象可响应。Vue 内部会用它来处理 data 函数返回的对象。
    // 可以直接用于 render 函数和 computed 内

    const state = Vue.observable({ count: 0 })

    var Profile = Vue.extend({
      render(h){
        return h('button', {
          on: { click: () => { state.count++ }}
        }, `count is: ${this.count}`)
      },
      computed: {
        count: () => ++state.count
      }
    })

    new Profile().$mount('#root');
</script>
</body>
</html>